class ConsumerInfo
  include Mongoid::Document
  include Mongoid::Timestamps
  field :name, type: String # 姓名
  field :mobile, type: String # 手机号

  validates_length_of :name, maximum: 50
  validates :mobile, uniqueness: { message: '已存在' }, presence: true, format: {with: /1[3|4|5|7|8]\d{9}\z/, message: "不合法!"}
end
